package com.naiterui.ehp.bs.weixin.service;

import com.naiterui.ehp.bp.support.exception.BusinessException;
import com.naiterui.ehp.bs.weixin.entity.mysql.WeixinInfo;
import com.naiterui.ehp.bs.weixin.exception.WeixinException;
import com.naiterui.ehp.bs.weixin.vo.*;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;

/**
 * 用户Service
 */
public interface UserService {

    /**
     * 小程序登录
     */
    LoginVO miniappLogin(String code, String scene) throws WeixinException, WxErrorException;

    /**
     * 小程序注册
     */
    LoginUserVO miniappRegister(RegisterParamVO registerParamVO) throws WeixinException;

    /**
     * 服务号取关
     */
    void mpUnsubscribe(String openId, WxMpService wxMpService) throws WxErrorException;

    /**
     * 服务号关注、扫码
     *
     * @return
     */
    WeixinInfo mpRegister(String openId, String eventKey, WxMpService wxMpService) throws WxErrorException, BusinessException;

    boolean existPhone(Long userId);

    MiniappPhoneVO miniappPhone(MiniappPhoneParamVO miniappPhoneParamVO) throws WeixinException;

    void varifyCode(Long customerId, String phone, String code) throws WeixinException;

    void sendCode(Long customerId, String phone) throws WeixinException;

    /**
     * 处理用户授权小程序订阅消息模板
     * @param miniOpenId
     * @param list
     */
    void handleUserSubscribe(String miniOpenId, Object list);
}
